package com.woniu.micropropertyserver.parkmag.mapper;

import com.woniu.microcommonsserver.entity.ParkCarInfoEntity;
import com.woniu.microcommonsserver.entity.ParkInfoEntity;
import com.woniu.microcommonsserver.entity.ParkcarChangeInfoEntity;
import com.woniu.microcommonsserver.param.PageRequest;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author ：pengchufeng
 * @date ：Created in 2021/2/1
 * @description：车位mapper
 */
@Mapper
public interface ParkMapper {
    /**
     * 条件查询所有车位信息
     * @return
     */
    List<ParkCarInfoEntity> findBy(@Param("p") PageRequest request, @Param("park")ParkCarInfoEntity parkCarInfoEntity);

    /**
     * 条件查询所有车位变更信息
     * @return
     */
    List<ParkcarChangeInfoEntity> findChange(@Param("id")String id);

    /**
     * 条件查询所有停车场信息
     * @return
     */
    List<ParkInfoEntity> findPark();

    /**
     * 添加记录
     * @return
     */
    void addChange(@Param("pc")ParkcarChangeInfoEntity parkcarChangeInfoEntity);

    /**
     * 绑定
     * @return
     */
    void bind(@Param("park")ParkCarInfoEntity parkCarInfoEntity);

    /**
     * 取绑
     * @return
     */
    void unbind(@Param("pid")String hid);

    /**
     * 换绑
     * @return
     */
    void cBind(@Param("park")ParkCarInfoEntity parkCarInfoEntity);

    /**
     * 租贷
     * @return
     */
    void rent(@Param("park")ParkCarInfoEntity parkCarInfoEntity);


    /**
     * 换租
     * @return
     */
    void cRent(@Param("park")ParkCarInfoEntity parkCarInfoEntity);

    @ResultType(ParkCarInfoEntity.class)
    @Select("SELECT id,fk_park_id fkParkId,number,STATUS,checkstatus,user_name username,user_status userStatus,usetime,uid FROM park_car_info WHERE  uid=#{cardId} ")
    List<ParkCarInfoEntity > findByOCard(String  cardId);

}
